<style type="text/css">
    .uploadify-button {
        left: 0;
        width: 85px;
        height: 28px;
        background-repeat: no-repeat;
        border: none;
        padding: 0;
    }

    .uploadify:hover .uploadify-button {
        background-repeat: no-repeat;
        width: 85px;
        height: 28px;
    }

    .fileQueue {
        /*background-color: #F4F9FF;*/
        height: 55px;
        overflow: auto;
        width: 70%;
    }
</style>
<script type="text/javascript">
    //    var cghtfkfs = {
    //        grid:null,
    //        newRow:function () {
    //            cghtfkfs.grid.edatagrid("saveRow");
    //            var rows = cghtfkfs.grid.edatagrid("getRows");
    //            var month = 0;
    //            var sum = cghtfkfs.accounts() > 100 ? 100 : cghtfkfs.accounts();
    //            if (rows.length != 0)
    //                month = parseInt(rows[rows.length - 1].fksj) + 1;
    //            cghtfkfs.grid.edatagrid("appendRow", {
    //                fksj:month,
    //                fkbl:(100 - sum),
    //                isyf:false
    //            });
    //        },
    //        accounts:function () {
    //            var rows = cghtfkfs.grid.edatagrid("getRows");
    //            var sum = 0;
    //            for (var i = 0; i < rows.length; i++) {
    //                if (rows[i]['fkbl'])
    //                    sum += parseFloat(rows[i]['fkbl']);
    //            }
    //            return sum;
    //        },
    //        deleteR:function () {
    //            var row = cghtfkfs.grid.edatagrid("getSelected");
    //            if (row) {
    //                var index = cghtfkfs.grid.edatagrid("getRowIndex", row);
    //                cghtfkfs.grid.edatagrid("deleteRow", index);
    //            }
    //        },
    //        init541:function () {
    //            cghtfkfs.grid.edatagrid("loadData", {
    //                total:3,
    //                rows:[
    //                    {
    //                        fksj:1,
    //                        fkbl:50,
    //                        isyf:false
    //                    },
    //                    {
    //                        fksj:9,
    //                        fkbl:40,
    //                        isyf:false
    //                    },
    //                    {
    //                        fksj:13,
    //                        fkbl:10,
    //                        isyf:false
    //                    }
    //                ]
    //            });
    //        },
    //        valid:function () {
    //            var sum = cghtfkfs.accounts();
    //            return sum == 100;
    //        }
    //    };
    $(function () {
//        cghtfkfs.grid = $("#cght-fkfsedit").edatagrid({
//            url:$.webPath() + "/htgl/cghtgl/cght_fkfsList?cghtId=" + $("#cghtglForm input[name='cght.id']").val(),
//            singleSelect:true,
//            toolbar:"#cght-fkfsedit-toolbar",
//            fit:true,
//            fitColumns:true,
//            columns:[
//                [
//                    {field:"fksj", title:"发票进账后几个月应付", width:700, editor:{type:'numberbox', options:{required:true, min:0}}},
//                    {field:"fkbl", title:"比例(%)", width:324, editor:{type:'numberbox', options:{required:true, precision:4, min:0.1, max:100}}},
//                    {field:"isyf", title:"是否预付款", width:324, editor:{type:'combobox', options:{data:[
//                        {text:'否', value:false},
//                        {text:'是', value:true}
//                    ], panelHeight:50}}, formatter:function (v, r, i) {
//                        if (!v) return '否';
//                        if (v) return '是';
//                    }}
//                ]
//            ],
//            onLoadSuccess:function () {
//                var rows = $("#cght-fkfsedit").edatagrid("getRows");
//                if (rows.length == 0) {
//                    $("#cght-fkfsedit").edatagrid("appendRow", {
//                        fksj:1,
//                        fkbl:100,
//                        isyf:false
//                    });
//                }
//            }
//        });
//        $("#cght-fkfsedit_tj").click(function () {
//            cghtfkfs.newRow();
//        });
//        $("#cght-fkfsedit_sc").click(function () {
//            cghtfkfs.deleteR();
//        });
//        $("#cght-fkfsedit_541").click(function () {
//            cghtfkfs.init541();
//        });
    });
</script>
<script type="text/javascript" src="${base}/scripts/tool/htdygl.js"></script>
<script type="text/javascript" src="${base}/scripts/htgl/cghtcontent.js"></script>
<form id="cghtglForm" method="post" class="easyui-tabs" fit="true">
<#--<input id="bgjhhz_id" name="cght.bgjhhz.id"
       value="<#if cght??>${(cght.bgjhhz.id)!}<#else>${(bgjhhz.id)!}</#if>" type="hidden"/>-->
<input id="cght_htbm" type="hidden" value="${(cghtHtbm)!''}"/>
<input id="cght_emwtime" type="hidden" value="${(cghtEmwtime)!''}"/>
<input name="cght.id" type="hidden" value="${(cght.id)!''}"/>
<input name="htdyId" type="hidden" value="${(htdyId)!''}"/>
<input id="cght_htms" type="hidden" name="cght.htms" value="${(cght.htms)!''}"/>
<input id="cght_sfjs" type="hidden" name="cght.sfjs" value="${(cght.sfjs)!''}"/>
<input id="cght_orderid" type="hidden" name="cght.orderId" value="${(cght.orderId)!''}"/>
<input type="hidden" name="cght.cglx" value="cgrk"/>
<input id="cght_sbbm_qc" type="hidden" class="input-text" readonly="true"
       value="<#if cght??>${(cght.sbbm.qc)!}<#else>${(yg.zgjg.qc)!}</#if>"/>
<input id="cght_sbbm_id" name="cght.sbbm.id"
       value="<#if cght??>${(cght.sbbm.id)!}<#else>${(yg.zgjg.id)!}</#if>" type="hidden"/>

<input type="hidden" id="cght_zgjgId" value="${(gsId)!}"/>
<input type="hidden" id="cght_zggsId" value="${(zggsId)!}"/>

<div title="合同信息" style="height: 100%;overflow-y: auto">
<table style="width:98%;border-collapse: separate;border-spacing:0px 5px" class="tb tab-t">
    <col width="100px"/>
    <col width=""/>
    <col width="90px"/>
    <col width=""/>
    <col width="100px"/>
    <col width=""/>
    <tr>
        <th style="color:#f45212;">路&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;径：</th>
    <#--        <td colspan="5" style="font-weight: bold">
            <#if cght??>
                <span class="ljtip">${(cght.lj.mc)!}</span>
                <input type="hidden" name="cght.lj.id" value="${(cght.lj.id)!}"/>
            <#else>
                <span class="ljtip">${(lj.mc)!}</span>
                <input type="hidden" name="cght.lj.id" value="${(lj.id)!}"/>
            </#if>
            </td>-->
        <td colspan="5" style="font-weight: bold">
        <#--    <#if cght??>
                <span class="ljtip">${(cght.lj.mc)!}</span>
                <input type="hidden" name="cght.lj.id" value="${(cght.lj.id)!}"/>
            <#else>-->
            <#if cght??>
                <span class="ljtip">${(cght.lj.mc)!}</span>
                <input type="hidden" name="cght.lj.id" value="${(cght.lj.id)!}"/>

            <#else>
                <input id="cght_lj_id" name="cght.lj.id" type="text" value="${(cght.lj.id)!}" class="input-text"
                       style="width: 940px" required="true" missingMessage="路径不能为空！"/>
            </#if>
        </td>
    </tr>
   <#-- <tr>
        <th style="color:#f45212;">计&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;划：</th>
        <td colspan="5" style="font-weight: bold">
        <#if cght??>
            <span>${(cght.bgjhhz.sm)!}</span>
        <#else>
            <span>${(bgjhhz.sm)!}</span>
        </#if>
        </td>
    </tr>-->
    <tr>
        <th>签订日期：</th>
        <td>
            <input name="cght.qdrq" class="easyui-datebox input-text" required="true"
                   value="${(cght.qdrq?date)!}"/>
        </td>
        <th>投资付款时间：</th>
        <td><input id="cght_fksj" style="width:170px" name="cght.fksj" class="easyui-datebox input-text"
                   required="true" value="${(cght.fksj?date)!}"/>

            <th>预交货时间：</th>
        <td>
            <input name="cght.jhsj" class="easyui-datebox input-text"
                   value="<#if cght??>${(cght.jhsj?date)!}<#else>${startDate?date}</#if>"/>
        </td>
        <th style="display: none;">付款方式：</th>
        <td style="display: none;">
            <input id="cght_fkfs_id" name="cght.fkfs.id" type="text" value="${(cght.fkfs.id)!}"
                   class="input-text"/>
        </td>
    </tr>
    <tr>
        <th>签订地点：</th>
        <td>
            <input name="cght.qddd" maxlength="50" type="text" class="input-text"" value="${(cght.qddd)!}"/>
        </td>
        <th>交货地点：</th>
        <td>
            <input name="cght.jhdd" maxlength="50" class="input-text" value="${(cght.jhdd)!}"/>
        </td>

    <#-- <th>交货方式：</th>
     <td>
         <input id="cght_jhfs" name="cght.jhfs" maxlength="50" class="input-text" value="${(cght.jhfs)!}"/>
     </td>-->
        <th>到货仓库：</th>
        <td><input id="cght_ck_id" name="cght.ck.id" type="text" value="${(cght.ck.id)!}" class="input-text"
                   required="true"/></td>
    </tr>
    <tr>
        <th>申报公司：</th>
        <td>
            <input id="cght_sbgs_jc" type="text" class="input-text" readonly="true"
                   value="<#if cght??>${(cght.sbgs.jc)!}<#else>${(yg.zggs.jc)!}</#if>"/>
            <input id="cght_sbgs_id" name="cght.sbgs.id"
                   value="<#if cght??>${(cght.sbgs.id)!}<#else>${(yg.zggs.id)!}</#if>" type="hidden"/>
        </td>
        <th>申&nbsp;报&nbsp;&nbsp;人：</th>
        <td>
            <input type="hidden" id="cght_sbr_id" name="cght.sbr.id"
                   value="<#if cght??>${(cght.sbr.id)!}<#else>${(yg.id)!}</#if>"/>
            <input id="cght_sbr_xm" type="text" class="input-text" readonly="readonly"
                   value="<#if cght??>${(cght.sbr.xm)!}<#else>${(yg.xm)!}</#if>"/>
        </td>
        <th>采购公司：</th>
        <td>
            <input id="cght_wlfgs_id" name="cght.wlfgs.id" type="hidden" class="input-text"
                   value="<#if cght??>${(cght.wlfgs.id)!}<#else>${(yg.zggs.id)!}</#if>"/>
            <input id="cght_wlfgs_jc" type="text" class="input-text" readonly="readonly"
                   value="<#if cght??>${(cght.wlfgs.jc)!}<#else>${(yg.zggs.jc)!}</#if>"/>
        </td>
    </tr>
    <tr>
        <th>来源系统合同号:</th>
        <td colspan="3">
            <input name="cght.xsxt_htbm" class="easyui-validatebox input-text" required="true" style="width: 300px;"
                   value="<#if cght??>${(cght.xsxt_htbm)!}<#else>${(xhtbm)!}</#if>"/>&nbsp;&nbsp;&nbsp;多个用户英文（,）逗号分隔
        </td>
        <th>税&nbsp;率(%)：</th>
        <td>
            <input id="cght_sl" name="cght.sl" class="easyui-combobox input-text" type="text"
                   value="<#if cght??&&cght.sl??>${(cght.sl?string("0.0000"))!}<#else>17.0000</#if>"
                   data-options="precision:4,min:0,max:100"/>
        </td>

    <#-- <th>采购公司：</th>
     <td>
         <input id="cght_wlfgs_id" name="cght.wlfgs.id" type="hidden" class="input-text"
                value="<#if cght??>${(cght.wlfgs.id)!}<#else>${(yg.zgjg.id)!}</#if>"/>
         <input id="cght_wlfgs_jc" type="text" class="input-text" readonly="readonly"
                value="<#if cght??>${(cght.wlfgs.jc)!}<#else>${(yg.zgjg.jc)!}</#if>"/>
     </td>-->
    <#-- <#if (yg.zgjg.sfxyjz)?exists && !yg.zgjg.sfxyjz>
     <#-- <th>质&nbsp;押&nbsp;&nbsp;方：</th>
      <td>
          <input type="hidden" id="zyf_content_id" value="${(cght.zyf.id)!}"/>
          <input type="hidden" id="zyf_content_jc" value="${(cght.zyf.jc)!}"/>
          <input id="cght_zyf_id" name="cght.zyf.id" value="${(cght.zyf.id)!''}"
                 type="text" class="input-text" required="true"/>
      </td>-->
    <#-- </#if>&ndash;&gt;-->
    </tr>
    <tr>
        <th>免息天数：</th>
        <td>
            <input id="cght_mxts" name="cght.mxts" data-options="min:0,precision:0"
                   class="input-text easyui-numberbox" required="true"
                   value="<#if cght??&&cght.mxts??>${(cght.mxts)!}</#if>"/>
        </td>
        <th>月贴息率(%)：</th>
        <td>
            <input id="cght_txl" name="cght.txl" data-options="min:0,precision:3"
                   class="input-text easyui-numberbox" required="true"
                   value="<#if cght??&&cght.txl??>${(cght.txl)!}</#if>"/>
        </td>
        <th>供&nbsp;应&nbsp;&nbsp;商：</th>
        <td>
            <input id="cght_hzf_id" name="cght.hzf.id" type="text" value="${(cght.hzf.id)!}"
                   class="input-text" required="true"/>
        </td>
    </tr>

<#--  <tr style="height: 30px">
      <th>价格是否相同</th>
      <td colspan="5">
          <select name="cght.jgsfxt" class="easyui-combobox"
                  style="width:166px;" data-options="panelHeight:'150'" required="true">
              <option value=""></option>
              <option value="0" <#if cght??&&cght.jgsfxt??&&cght.jgsfxt == '0'>selected="selected" </#if> >不相同
              </option>
              <option value="1" <#if cght??&&cght.jgsfxt??&&cght.jgsfxt == '1'>selected="selected" </#if> >相同
              </option>
          </select>
          &nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red;font-size: 16;font-weight: bold">
           说明：这里主要是判断实际结算价和采购合同价是否相同，如果相同，结算时按采购合同价进行结算。
          </span>
      </td>
  </tr>-->
    <tr>
        <th>现金优惠(%):</th>
        <td>
            <input id="cght_yhbl" name="cght.yhbl" data-options="min:0,precision:6"
                   class="input-text easyui-numberbox" required="true"
                   value="<#if cght??&&cght.yhbl??>${(cght.yhbl)!}</#if>"/>
        </td></tr>
    <tr id="cght_htmsyc">
   <#-- <#if (cght.htms)??&&cght.htms=='xxms'>-->
        <th>是否后定价:</th>
        <td>
        <#if sfhdj??&&sfhdj>是<input type="checkbox" hidden="true" id="cght_sfhdj" checked="checked" name="cght.sfhdj"
                                    value="true"/><#else>
            <input type="checkbox" id="cght_sfhdj" name="cght.sfhdj" value="true"
                   <#if (sfhdj?? && sfhdj)||(cght??&&cght.sfhdj??&&cght.sfhdj)>checked="checked"</#if>/>
        </#if>
        </td>
        <th>保证金使用方式：</th>
        <td>
            <label><input name="cght.bzjfs" type="radio" value="0" checked="checked"
                          style="vertical-align: middle;"/>一次性使用</label> &nbsp;&nbsp;&nbsp;&nbsp;
            <label><input name="cght.bzjfs" type="radio" value="1"
                          <#if (cght.bzjfs)?? && cght.bzjfs==1>checked</#if>
                          style="vertical-align: middle;"/>按比例使用</label> &nbsp;&nbsp;&nbsp;&nbsp;
            <label><input name="cght.bzjfs" type="radio" value="2"
                          <#if (cght.bzjfs)?? && cght.bzjfs==2>checked</#if>
                          style="vertical-align: middle;"/>无保证金</label>&nbsp;&nbsp;&nbsp;&nbsp;
        </td>
  <#--  </#if>-->
    </tr>
    <tr>
        <th>备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：</th>
        <td colspan="5">
            <textarea name="cght.bz" rows="4" cols="45" class="textarea"
                      style="width: 91%">${(cght.bz)!}</textarea>
        </td>
    </tr>
</table>
<div id="cght-fileQueue" class="fileQueue" style="float: left;margin-left:80px">
<#if cght??>
    <#list cght.fjList as fj>
        <div id="cght-files${fj.id}" class="uploadify-queue-item">
            <div class="cancel">
                <a href="javascript:void(0)" onclick="deleteCghtFile('${fj.id}','cght-files${fj.id}')">X</a>
            </div>
            <span class="fileName">${(fj.ccmc)!}</span><span class="data"></span>
        </div>
        <input type="hidden" id="cght-file${fj.id}" name="cght.fjList.id" value="${(fj.id)!}"/>
    </#list>
</#if>
</div>
<div style="float: right;margin: 8px 15px 0 0;">
    <input type="file" name="file" id="cght-uploadify"/>
</div>

</div>
<div title="合同明细">
   <div id="cghtmx_toolbar">
    <div class="PTools">
      <ul class="niu">
       <li><a id="hqmx" href="javascript:void(0);" plain="true">获取明细</a></li>
     </ul>
    </div>
</div>
    <table id="cght_mx">
    </table>
</div>
<#--<div title="付款方式" style="height:100%">-->
<#--<div id="cght-fkfsedit-toolbar">-->
<#--<div class="PTools">-->
<#--<ul class="niu">-->
<#--<li><a href="javascript:void(0);" id="cght-fkfsedit_tj" plain="true">添加</a></li>-->
<#--<li><a href="javascript:void(0);" id="cght-fkfsedit_sc" class="del" plain="true">删除</a></li>-->
<#--<li><a href="javascript:void(0);" id="cght-fkfsedit_541" class="rep" plain="true">541</a></li>-->
<#--</ul>-->
<#--</div>-->
<#--</div>-->
<#--<table id="cght-fkfsedit"></table>-->
<#--</div>-->
<div title="合同文本" style="overflow:hidden">
    <div id="-toolbar">
        <div class="PTools">
            <ul class="niu">
                <li><span class="xuan">选择合同模板：</span>
                    <input id="cght_htmb_id" name="cght_htmb" type="text" class="searchinput-text">
                </li>
                <li><a class="she" href="javascript:void(0);" onclick="checkIsInstall('')">检查插件</a></li>
                <li><a class="watch" href="javascript:void(0);"
                       onclick="printPreview('${(cghtHtbm)!}','${(cghtEmwtime)!}','')">打印预览</a></li>
                <li><a class="pen" href="javascript:void(0);"
                       onclick="print('${(cghtHtbm)!}','${(cghtEmwtime)!}','')">打印</a></li>
                <li><a class="baocun" href="javascript:void(0);" onclick="htwb_save('cght')">保存合同</a></li>
                <li><a class="baocun" href="javascript:void(0);" onclick="htmb_save()">另存为模板</a>
                    <input id="cght_mbname" name="cght_mbname" type="text" class="searchinput-text"/>
                </li>
            </ul>
        </div>
    </div>

    <div style="overflow:auto;height:90%">
        <object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
            <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0
                   pluginspage="install_lodop32.exe"></embed>
        </object>
        <div id="htwb_cght_id" class="textcon"></div>
    </div>
</div>
</form>